package com.xiaoboframework.api.bean;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;

/**
 * @author: <a href="get_xiaobo@163.com">Josh_Xu</a>
 * @description:
 * @create: 2020-05-22 15:39
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Document(collection = "message") //指定表名 默认以类名
public class Message implements Serializable {

    private static final long serialVersionUID = 12121L;

    @Id
    private ObjectId id;

    private String msg;

    /**
     * mongodb索引
     * 1-已读
     * 0-未读
     */
    @Indexed
    private Integer status;

    @Field(value = "send_date")
    private String sendDate;

    @Field(value = "read_date")
    private String readDate;

    @Indexed
    private Account from;

    @Indexed
    private Account to;
}
